package Behavior;

import jade.core.Agent;
import jade.core.behaviours.TickerBehaviour;
import jade.lang.acl.ACLMessage;

import Messages.AMessage;
import AOP.Printer;
import Agents.AActuator;
import Agents.Messageable;
import Agents.Sensor.ASensor;

@SuppressWarnings("serial")
public class MeasureInformerBehavior extends TickerBehaviour
{
	public MeasureInformerBehavior(ASensor a, Long time)
	{
		super((Agent)a, time);
	}

	protected void onTick() 
	{
		((ASensor)myAgent).getMeasuredValue();
		ACLMessage message = new ACLMessage( ACLMessage.INFORM );
		message.setContent(AMessage.constructMessage((Messageable)myAgent, AMessage.MessageType.MEASUREMENT));
		Printer.Print(myAgent.getLocalName(), ((ASensor)myAgent).value);
		AMessage.broadcastToAll((Messageable)myAgent, message);
		//inform measured;
	}
}
